---
import { getCollection } from 'astro:content';
import type { InternalFramework } from '@ag-grid-types';
import DocsFrameworkTemplate from '@features/docs/components/DocsFrameworkTemplate.astro';
import { getDocsExamplePages } from '@features/docs/utils/pageData';
import { isReactInternalFramework } from '@utils/framework';

/**
 * This page is the same as `[exampleName].astro`, but for Code Sandbox examples
 */
export async function getStaticPaths() {
    const pages = await getCollection('docs');
    return getDocsExamplePages({
        pages,
    });
}

const { internalFramework, pageName, exampleName, importType } = Astro.params;

const ignoreSystemJs = isReactInternalFramework(internalFramework);
/**
 * Hide highlighter element that gets added by code sandbox
 */
const extraStyles = `
/* Hide codesandbox highlighter */
body > #highlighter {
    display: none;
}`;
---

<DocsFrameworkTemplate
    internalFramework={internalFramework as InternalFramework}
    pageName={pageName!}
    exampleName={exampleName!}
    importType={importType!}
    relativePath={true}
    ignoreSystemJs={ignoreSystemJs}
    extraStyles={extraStyles}
/>
